<template>
  <div class="section">
    <div class="section-title">
      <div>
        <Icon :custom="'i-icon '+icon"
              :size="iconSize"
              class="section-title-icon" />
        <span>{{title}}</span>
      </div>
      <template v-if="$slots.right">
        <slot name="right"></slot>
      </template>
      <template v-else>
        <Icon custom="i-icon icon-jiantou2"
              size="20"
              class="cursor-pointer"
              v-if="rightIcon"
              @click.stop="onClickRightIcon" />
      </template>
    </div>
    <slot></slot>
  </div>
</template>

<script>
export default {
  components: {},
  props: {
    icon: String,
    iconSize: {
      type: Number,
      default: 24,
    },
    title: String,
    rightIcon: Boolean
  },
  data () {
    return {

    };
  },
  mounted () {
    this.init()
  },
  methods: {
    init () {

    },
    onClickRightIcon () {
      this.$emit('onClickRightIcon')
    }
  },
}
</script>

<style lang='scss' scoped>
.section {
  background: rgba(25, 34, 41, 0.85);
  border-radius: 8px;
  padding: 16px 16px 24px 20px !important;
  margin-bottom: 8px;
  background-image: url(../../../../assets/main/com_bg.png);
  background-position: top;
  background-size: cover;
  background-size: 100% 158px;
  background-repeat: no-repeat;
  .section-title {
    color: #eee;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 26px;
    .section-title-icon {
      width: 36px;
      background-image: url(../../../../assets/main/bg_icontitle.png);
      background-position: bottom;
      background-size: cover;
    }
  }
}
</style>